package com.addplus.townmall.server.queue.serviceimpl;

import com.addplus.townmall.server.api.model.town.param.ShopProductStockManagerParam;
import com.addplus.townmall.server.api.modelenum.QueueEnum;
import com.addplus.townmall.server.api.service.queue.ShopProductFightManagerService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 类名: ShopProductFightManagerServiceImpl
 *
 * @author zhangjiehang
 * @version V1.0
 * @date 2018/11/17 7:35 PM
 * @description 类描述: 商品拼团商品订单队列处理类
 */
@Service(interfaceClass = ShopProductFightManagerService.class, async = true)
public class ShopProductFightManagerServiceImpl implements ShopProductFightManagerService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void shopProductFightStockQueue(ShopProductStockManagerParam stockManagerParam) {
        if (stockManagerParam != null) {
            rabbitTemplate.convertAndSend(QueueEnum.FIGHT_STOCK_QUEUQ.getExchange(), QueueEnum.FIGHT_STOCK_QUEUQ.getRoutingKey(), stockManagerParam);
        }
    }
}
